<%@ page import="com.ama.utils.SpringUtils" %>
<%@ page import="com.ama.service.impl.*" %>
<%@ page import="com.ama.pojo.*" %>
<%@ page import="com.ama.dao.CostDao" %>
<%@ page import="com.ama.utils.NumberUtils" %>
<%@ page import="com.ama.service.*" %>
<%--  Created by IntelliJ IDEA.--%>
<%--  User: zez--%>
<%--  Date: 2020/12/20--%>
<%--  Time: 14:47--%>
<%--  To change this template use File | Settings | File Templates.--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html lang="zh">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" />
    <title>费用单</title>
    <link rel="icon" href="favicon.ico" type="image/ico">
    <meta name="keywords" content="">
    <meta name="description" content="">
    <meta name="author" content="">
    <link href="../css/bootstrap.min.css" rel="stylesheet">
    <link href="../css/materialdesignicons.min.css" rel="stylesheet">
    <link href="../css/style.min.css" rel="stylesheet">
</head>

<body>
<%
    Long costId = Long.valueOf(request.getParameter("costId"));
    CostDao costDao = SpringUtils.getBean(CostDao.class);
    Cost cost = costDao.selectById(costId);
    StaffService staffService = SpringUtils.getBean(StaffServiceImpl.class);
    Staff staff = staffService.selectById(cost.getStaffId());

    BedServiceImpl bedService = SpringUtils.getBean(BedServiceImpl.class);
    EstateService estateService = SpringUtils.getBean(EstateServiceImpl.class);
    RoomService roomService = SpringUtils.getBean(RoomServiceImpl.class);
    PropertyService propertyService = SpringUtils.getBean(PropertyServiceImpl.class);


    Long bedId = cost.getBedId();
    Bed bed = bedService.selectById(bedId);
    Estate estate = estateService.selectById(bed.getEstateId());

    Room room = roomService.selectById(bed.getRoomId());
    Property property = propertyService.selectById(estate.getPropertyId());

    double roomcost = NumberUtils.round(room.getRoomRentarea()*room.getRoomPrice() + room.getRoomPublicarea()*1 ,2);

%>
<div class="container-fluid p-t-15">

    <div class="row">
        <div class="col-lg-12">
            <div class="card">
                <div class="card-body">
                    <div class=" text-center m-b-10"><h4>费用账单</h4></div>
                    <form action="#" method="post" class="guide-box" data-navigateable="true">

                    <div class="row m-b-10">
                        <div class="col-lg-12">
                            <div class="input-group">
                                    <span class="input-group-btn">
                                      <button class="btn btn-default" type="button">费用编号</button>
                                    </span>
                                <input type="text" class="form-control bg-white" readonly value="<%=cost.getCostNum()%>">
                            </div>
                        </div>
                    </div>

                    <div class="row m-b-10">
                        <div class="col-lg-6">
                            <div class="input-group">
                                    <span class="input-group-btn">
                                      <button class="btn btn-default" type="button">员工名称</button>
                                    </span>
                                <input type="text" class="form-control bg-white" readonly value="<%=staff.getStaffName()%>">
                            </div>
                        </div>



                        <div class="col-lg-6">
                            <div class="input-group">
                                    <span class="input-group-btn">
                                      <button class="btn btn-default" type="button">物业名称</button>
                                    </span>
                                <input type="text" class="form-control bg-white" readonly value="<%=property.getPropertyName()%>">
                            </div>
                        </div>
                    </div>

                    <div class="row m-b-10">
                        <div class="col-lg-6">
                            <div class="input-group">
                                    <span class="input-group-btn">
                                      <button class="btn btn-default" type="button">房间名称</button>
                                    </span>
                                <input type="text" class="form-control bg-white" readonly value="<%=room.getRoomName()%>">
                            </div>
                        </div>



                        <div class="col-lg-6">
                            <div class="input-group">
                                    <span class="input-group-btn">
                                      <button class="btn btn-default" type="button">铺位名称</button>
                                    </span>
                                <input type="text" class="form-control bg-white" readonly value="<%=bed.getBedName()%>">
                            </div>
                        </div>
                    </div>

                    <div class="row m-b-10">
                        <div class="col-lg-12">
                            <div class="input-group">
                                    <span class="input-group-btn">
                                      <button class="btn btn-default" type="button">房屋租金</button>
                                    </span>
                                <input type="text" class="form-control bg-white" readonly value="<%=roomcost%>">
                            </div>
                        </div>
                    </div>

                    <div class="row m-b-10">
                        <div class="col-lg-6">
                            <div class="input-group">
                                    <span class="input-group-btn">
                                      <button class="btn btn-default" type="button">水费</button>
                                    </span>
                                <input type="text" class="form-control bg-white" readonly value="<%=cost.getCostWater()%>">
                            </div>
                        </div>

                        <div class="col-lg-6">
                            <div class="input-group">
                                    <span class="input-group-btn">
                                      <button class="btn btn-default" type="button">电费</button>
                                    </span>
                                <input type="text" class="form-control bg-white" readonly value="<%=cost.getCostElec()%>">
                            </div>
                        </div>
                    </div>

                    <div class="row m-b-10">
                        <div class="col-lg-6">
                            <div class="input-group">
                                    <span class="input-group-btn">
                                      <button class="btn btn-default" type="button">税率</button>
                                    </span>
                                <input type="text" class="form-control bg-white" readonly value="<%=cost.getCostTax()%>">
                            </div>
                        </div>

                        <div class="col-lg-6">
                            <div class="input-group">
                                    <span class="input-group-btn">
                                      <button class="btn btn-default" type="button">税费金额</button>
                                    </span>
                                <input type="text" class="form-control bg-white" readonly value="<%=cost.getCostTaxamount()%>">
                            </div>
                        </div>
                    </div>

                    <div class="row m-b-10">
                        <div class="col-lg-6">
                            <div class="input-group">
                                    <span class="input-group-btn">
                                      <button class="btn btn-default" type="button">费用总金额</button>
                                    </span>
                                <input type="text" class="form-control bg-white" readonly value="<%=NumberUtils.round(cost.getCostAmount()*3,2)%>(三个月费用)">
                            </div>
                        </div>

                        <div class="col-lg-6">
                            <div class="input-group">
                                    <span class="input-group-btn">
                                      <button class="btn btn-default" type="button">应收金额</button>
                                    </span>
                                <input type="text" class="form-control bg-white" readonly value="<%=NumberUtils.round(cost.getCostAmount()*3,2)%>(三个月费用)">
                            </div>
                        </div>
                    </div>

                    <div class="row m-b-10">
                        <div class="col-lg-12">
                            <div class="input-group">
                                    <span class="input-group-btn">
                                      <button class="btn btn-default" type="button">付款日期</button>
                                    </span>
                                <input type="text" class="form-control bg-white" readonly value="<%=cost.getCostPaydate()%>">
                            </div>
                        </div>
                    </div>

                    <div class="row m-b-10">
                        <div class="col-lg-6">
                            <div class="input-group">
                                    <span class="input-group-btn">
                                      <button class="btn btn-default" type="button">费用起始日</button>
                                    </span>
                                <input type="text" class="form-control bg-white" readonly value="<%=cost.getCostCreatdate()%>">
                            </div>
                        </div>

                        <div class="col-lg-6">
                            <div class="input-group">
                                    <span class="input-group-btn">
                                      <button class="btn btn-default" type="button">费用截止日</button>
                                    </span>
                                <input type="text" class="form-control bg-white" readonly value="<%=cost.getCostEnddate()%>">
                            </div>
                        </div>
                    </div>

                        <div class="row m-b-10">
                            <div class="col-lg-1">
                                <div class="form-group">
                                    <span class="input-group-btn">
                                          <button class="btn btn-default" type="button">费用状态</button>
                                    </span>
                                </div>
                            </div>
                            <div class="col-lg-1">
                                <%
                                    if(cost.getCostState()==0){
                                %>
                                <button class="btn btn-warning btn-w-md" >等待审批</button>
                                <%
                                }else if(cost.getCostState()==1){
                                %>
                                <button class="btn btn-success btn-w-md" >已缴费</button>
                                <%
                                }else if(cost.getCostState()==-1){
                                %>
                                <button class="btn btn-warning btn-w-md" >待缴费</button>
                                <%
                                    }else if (cost.getCostState()==-2){
                                %>
                                <button class="btn btn-danger btn-w-md" >已超时！尽快缴费</button>
                                <%
                                    }else if(cost.getCostState()==-3){
                                %>
                                <button class="btn btn-danger btn-w-md" >已取消</button>
                                <%
                                    }
                                %>
                            </div>


                        </div>

                    <div class="row m-b-10">
                        <div class="col-lg-12">
                            <div class="input-group">
                                    <span class="input-group-btn">
                                      <button class="btn btn-default" type="button">备注</button>
                                    </span>
                                <input type="text" class="form-control bg-white" readonly value="<%=NumberUtils.round(cost.getCostAmount()*3,3)%>---(租用面积*房间单价+公摊面积*1+水电费+)*3个月*税率">
                            </div>
                        </div>
                    </div>

                        <hr>

                    <div class="nav-step-button">
                        <%--                            <a class="btn btn-secondary" hidden="hidden" disabled="" data-wizard="prev" type="button" href="s_bed.jsp?room=<%=bed.getRoomId()%>">上一步</a>--%>
                            <a class="btn btn-secondary"  data-wizard="prev" type="button" href="mes_apply.jsp">返&nbsp;回</a>
                        <a class="btn btn-secondary" href="/cancelApply" >打印申请单</a>
<%--                        <button class="btn btn-secondary"<%--%>
<%--                            if(cost.getCostState()==0||cost.getCostState()==1||cost.getCostState()==-3){--%>
<%--                        %>--%>
<%--                                disabled--%>
<%--                                <%--%>
<%--                                    }--%>
<%--                                %>--%>
<%--                                data-wizard="next" type="submit">账单缴费</button>--%>
                    </div>

                    </form>
                </div>
            </div>
        </div>
    </div>



</div>


<script type="text/javascript" src="../js/jquery.min.js"></script>
<script type="text/javascript" src="../js/bootstrap.min.js"></script>
<script type="text/javascript" src="../js/main.min.js"></script>

<!--图表插件-->
<script type="text/javascript" src="../js/Chart.js"></script>
<script type="text/javascript"></script>

</body>
</html>